What is the best way to reference (use as foreign key) a table with
multiple primary keys?
Here's what I have:
Table1:
field1
field2
field3
...
primary key (field1, field2, field3)
Then I have another table that needs to reference Table1 with a
foreign key. What I really want to do is:
Table2:
field1 Primary key
field2 references table1
...
But that doesn't work. I haven't yet tried the option of giving
Table2 all three fields of Table1, partly because I'm not really sure
how to write that... (I did try linking it to the implicit field
generated when I created Table1. Didn't work.) The option I'm sure
would work is shoving all three key fields of Table1 into one field,
but that's a bit messy with the data. (Though it is doable.)
Is there any really good way to do this that I'm just missing?
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------